package simplega;

public class RoulleteWheel{
	private int[] rouletteWheel;
	private int rouletteWheelSize;
	
	public RoulleteWheel(int numGeneOfChrom, int numChromosome){
		// define the roulette wheel:
		rouletteWheelSize = 0;
		for (int i = 0; i < numGeneOfChrom; i++) {
			rouletteWheelSize += i + 1;
		}
		System.out.println("count of slots in roulette wheel="
				+ rouletteWheelSize);
		rouletteWheel = new int[rouletteWheelSize];
		int num_trials = numGeneOfChrom;
		int index = 0;
		for (int i = 0; i < numChromosome; i++) { 
			for (int j = 0; j < num_trials; j++) {
				rouletteWheel[index++] = i;
			}
			num_trials--;
		}		
	}
	public int getRoulleteWheelSize(){
		return this.rouletteWheelSize;
	}
	public int getRoulleteWheelSlot(int index){
		return this.rouletteWheel[index];
	}
}